package com.ruoyi.common.business.service.impl;

import com.ruoyi.common.business.entity.YytHomeAdv;
import com.ruoyi.common.business.dao.YytHomeAdvMapper;
import com.ruoyi.common.business.service.YytHomeAdvService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 首页轮播广告 服务实现类
 * </p>
 *
 * @author huangshun
 * @since 2021-12-16
 */
@Service
public class YytHomeAdvServiceImpl extends ServiceImpl<YytHomeAdvMapper, YytHomeAdv> implements YytHomeAdvService {

    @Autowired
    private YytHomeAdvMapper yytHomeAdvMapper;

    /**
     * 获取轮播图列表
     */
    @Override
    public List<Map<String, String>> clientSwiperList() {
        return yytHomeAdvMapper.clientSwiperList(DateUtils.DTF.format(LocalDateTime.now()));
    }

    /**
     * 增加轮播图点击数
     */
    @Override
    public void increaseClickCount(String id) {
        yytHomeAdvMapper.increaseClickCount(id);
    }
}
